<?php
if(!defined('security'))
{
	exit();
    
}

$ip_address = $_SERVER['REMOTE_ADDR']; 

$stats = dir_stats('./data');
if($stats['size'] > 1000000)
{
        $stats['size'] = number_format( $stats['size'] / 1000000 ) . ' MB';
}
else
{
        $stats['size'] = number_format( $stats['size'] / 1000 ) . ' KB';
}
$total_files[] = $stats['files'] . ' tập tin';
$total_size[] = $stats['size'];
$total_dirs[] = $stats['dirs'];

$Info = array();

$query = $DB->Query("Select id From cms_content");
$Info['SiteNum'] = $DB->FetchNum($query);

if ( function_exists('fopen') && function_exists('curl_init') && function_exists('mysql_set_charset') ) 
{
	$Info['Support'] = "Được phép";
}
else
{
	$Info['Support'] = "Không được phép";
}


$Template->assign('total_files', implode('<br />' , $total_files));
$Template->assign('total_size', implode('<br />' , $total_size));
$Template->assign('total_dirs', implode('<br />' , $total_dirs));
$Template->assign('ip_address', $ip_address);
$Template->assignByRef('Info',$Info);

$query = $DB->Query("Select * From cms_webpage");
$i=0;
while ( $row=$DB->FetchArray($query) )
{
	$stat[$i]['name'] = $row['name'];
	$query = $DB->Query("");
	

	$i++;
}

$Template->assign('stat',$stat);
$Template->display('statistic.html');
?>